class MinStack:

    def __init__(self):
        """
        initialize your data structure here.
        """
        self.stack = []
        self.min_stack = []

    def push(self, x: int) -> None:
        self.stack.append(x)
        if len(self.stack) == 1 or self.min_stack[-1] >= x:
            self.min_stack.append(x)

    def pop(self) -> None:
        # 小 trick: python 中函数的返回是向上返回的, 如果上层没有变量接收, 就继续向上返回, 直到被接收或者被丢弃. 
        if self.stack.pop() == self.min_stack[-1]:
            self.min_stack.pop()

    def top(self) -> int:
        return self.stack[-1]

    def min(self) -> int:
        return self.min_stack[-1]


if __name__ == "__main__":
    minStack = MinStack()
    minStack.push(-2)
    minStack.push(0)
    minStack.push(-3)
    minStack.min()
    minStack.pop()
    minStack.top()
    minStack.min()
    print("Done!")
